<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Dubbo动态发布系统</title>

    <!--angular-->
    <script src="/webjars/angularjs/1.4.8/angular.js"></script>
    <script src="/webjars/angularjs/1.4.8/angular-resource.js"></script>
    <script src="/webjars/angularjs/1.4.8/angular-route.js"></script>

    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="/webjars/adminlte/2.3.2/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="/webjars/font-awesome/4.5.0/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="/webjars/ionicons/2.0.1/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="/webjars/adminlte/2.3.2/dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="/webjars/adminlte/2.3.2/dist/css/skins/_all-skins.min.css">
    <!-- jQuery 2.1.4 -->
    <script src="/webjars/adminlte/2.3.2/plugins/jQuery/jQuery-2.1.4.min.js"></script>
    <!-- Bootstrap 3.3.5 -->
    <script src="/webjars/adminlte/2.3.2/bootstrap/js/bootstrap.min.js"></script>
    <!-- Slimscroll -->
    <script src="/webjars/adminlte/2.3.2/plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <!-- FastClick -->
    <script src="/webjars/adminlte/2.3.2/plugins/fastclick/fastclick.min.js"></script>
    <!-- AdminLTE App -->
    <script src="/webjars/adminlte/2.3.2/dist/js/app.min.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="/webjars/adminlte/2.3.2/dist/js/demo.js"></script>

    <!-- Bootstrap Color Picker -->
    <link rel="stylesheet" href="/webjars/adminlte/2.3.2/plugins/colorpicker/bootstrap-colorpicker.min.css">

    <link rel="stylesheet" href="/webjars/adminlte/2.3.2/plugins/select2/select2.min.css">
    <script src="/webjars/adminlte/2.3.2/plugins/select2/select2.full.min.js"></script>

    <link rel="stylesheet" href="/webjars/datetimepicker/2.4.7/jquery.datetimepicker.css">
    <link rel="stylesheet" href="/webjars/adminlte/2.3.2/plugins/iCheck/all.css">
    <script src="/webjars/datetimepicker/2.4.7/build/jquery.datetimepicker.full.js"></script>
</head>
<body ng-app="undeployApp">
<!-- Content Wrapper. Contains page content -->
<div>
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            服务管理
            <small>主机列表</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i>服务管理</a></li>
            <li><a href="#">主机列表</a></li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row" ng-controller="undeployController">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-body">
                        <div class="row">
                            <div class="col-xs-5">
                                <form action="#"
                                      method="get" class="sidebar-form">

                                    <div class="input-group">
                                        <input name="search" ng-model="search" value="" class="form-control"
                                               placeholder="Search..." type="text"> <span
                                            class="input-group-btn">
												<button type="submit" name="search" id="search-btn"
                                                        class="btn btn-flat">
													<i class="fa fa-search"></i>
												</button>
                                            <button type="button" onclick="window.location='/upload/upload.html'"
                                                    class="btn btn-primary">上传Jar包</button>
                                            <button type="button" onclick="window.location='/upload/upload.html'"
                                                    class="btn btn-primary">扫描Jar包</button>
                                            <button type="button" onclick="addService()"
                                                    class="btn btn-primary">添加服务</button>
											</span>
                                    </div>
                                </form>
                            </div>

                        </div>

                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table id="table1"
                               class="table table-bordered  table-striped table-hover">
                            <thead>
                            <tr>
                                <th>Application</th>
                                <th>Host</th>
                                <th>Port</th>
                                <th>Url</th>
                                <th>Timestamp</th>
                                <th>Operation</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr ng-repeat="item in data| filter:search">
                                <td>{{item.application}}</td>
                                <td>{{item.host}}</td>
                                <td>{{item.port}}</td>
                                <td>{{item.url}}</td>
                                <td>{{item.timestamp | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                                <td>
                                    <button class="btn btn-primary btn-sm"
                                            onclick="editDB('${datasource.id }')">
                                        <i class="glyphicon glyphicon-edit">编辑</i>
                                    </button>
                                    <button class="btn btn-info btn-sm"
                                            onclick='genneratorModalPop("${datasource.id }")'>发布
                                    </button>
                                    <button class="btn btn-danger btn-sm"
                                            onclick="delDB('${datasource.id }')" type="button">
                                        <i class="fa fa-trash-o">删除</i>
                                    </button>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
        </div>
    </section>
    <!-- /.content -->
</div>

<div class='modal' id='addService'>
    <div class='modal-dialog'>
        <div class='modal-content'>
            <div class='modal-header'>
                <button type='button' class='close' data-dismiss='modal'>
                    <span aria-hidden='true'>×</span><span class='sr-only'>Close</span>
                </button>
                <h4 class='modal-title'>添加服务</h4>
            </div>
            <div class='modal-body'>
                <form action="" method="post" role='form'>
                    <div class='form-group'>
                        <label>服务名称：</label>
                        <input type='text'
                               class='form-control' name="id" ng-model="id">
                    </div>
                    <div class='form-group'>
                        <label>接口全路径:</label>
                        <input type='text' class='form-control' name="iFaceClazzName" ng-model="iFaceClazzName"
                               placeholder='example: com.vcg.dubbo.service.UserService'>
                    </div>
                    <div class='form-group'>
                        <label>实现类全路径:</label>
                        <input type='text' class='form-control' name="implClazzName" ng-model="implClazzName"
                               placeholder='example: com.vcg.dubbo.service.UserServiceImpl'>
                    </div>

                    <div class="form-group">
                        <label>使用Jar包:</label>
                        <div class="form-group">
                            <label class="radio-inline">
                                <input type="radio"
                                       name="type" checked="checked" value="1">Springboot
                            </label> <label class="radio-inline">
                            <input type="radio"
                                   name="type" value="2">普通Spring项目
                        </label>
                        </div>
                    </div>
                    <div class='modal-footer'>
                        <button type='button' class='btn btn-default'
                                data-dismiss='modal'>关闭
                        </button>
                        <button type="submit" id='execute' class='btn btn-primary'>完成</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
</div>
</body>

<!-- /.content-wrapper -->
<script>
    function addService() {
        $('#addService').modal('toggle')
    }
</script>
<script>
    var serviceModule = angular.module('undeployApp', []);
    serviceModule.controller("undeployController", function ($scope, $http) {
        $http.get("/dynamic/listDynamicService")
                .success(function (response) {
                            $scope.data = response;
                        }
                );

    })
</script>
</html>